//
//  LLLoadingViewManager.m
//  TaoTuo
//
//  Created by LG on 2020/9/23.
//  Copyright © 2020 刘广. All rights reserved.
//

#import "LLLoadingViewManager.h"
#import "LLLoadingView.h"

@implementation LLLoadingViewManager

/// 显示
+ (void)showLoadingViewInView:(UIView *)view
{
    LLLoadingView *loadingView = [[LLLoadingView alloc] initWithFrame:view.bounds];
    loadingView.backgroundColor = UIColor.whiteColor;
    [view addSubview:loadingView];
    
    if (view.width == 0 || view.height == 0) {
        
        [loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(view);
        }];
        
    }
}

/// 隐藏
+ (void)hiddenLoadingViewInView:(UIView *)view
{
    for (UIView *subView in view.subviews) {
        if ([subView isKindOfClass:[LLLoadingView class]]) {
            subView.hidden = YES;
            [subView removeFromSuperview];
            break;
        }
    }
}

@end
